package br.com.dev.tcc.util.alarm;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import br.com.dev.tcc.R;

public class NotificationUtil {

	public static final int NOTIFICATION_ID = 100;

	Notification n = null;

	public static void createNotification(Context context, String ticker,
			String contentTitle, String contentText, int idApolice) {

		NotificationManager notificationManager = (NotificationManager) context
				.getSystemService(Activity.NOTIFICATION_SERVICE);

		PendingIntent it = PendingIntent.getBroadcast(context, 0, new Intent(),
				PendingIntent.FLAG_UPDATE_CURRENT);

		NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
				context).setSmallIcon(R.drawable.ic_launcher).setTicker(ticker)
				.setContentTitle(contentTitle).setContentText(contentText)
				.setVibrate(new long[] { 100, 250, 100, 500 })
				.setContentIntent(it);

		Notification notif = mBuilder.build();
		notif.flags |= Notification.FLAG_AUTO_CANCEL;

		notificationManager.notify(NOTIFICATION_ID + idApolice, notif);
	}
}
